<template>
  <div>
    <span @click="submit">
      <yn-button>确定</yn-button>
    </span>
    <userchild :msg="msg"></userchild>

    <yn-select style="width:100px" @change="getUser" placeholder="请选择">
      <yn-select-option
        v-for="(item, index) in dataUser"
        :key="index"
        :value="item.username"
      >
        {{ item.username }}
      </yn-select-option>
    </yn-select>
    <select style="width:100px" @change="getUserSelect" placeholder="请选择">
      <option
        v-for="(item, index) in dataUser"
        :key="index"
        :value="item.username"
      >
        {{ item.username }}
      </option>
    </select>
  </div>
</template>

<script>
import "yn-p1/libs/components/yn-select";
import "yn-p1/libs/components/yn-select-option";
import "yn-p1/libs/components/yn-button";
import userchild from "./userchild.vue";
export default {
  components: { userchild },
  data() {
    return {
      msg: "123",
      userNum: 990,
      dataUser: [{ username: "王二狗" }, { username: "9123" }]
    };
  },
  methods: {
    submit() {
      this.msg += "456";
      this.$store.commit("component/mutationsCount", this.userNum); //使用vuex
    },
    getUser(value) {
      window.console.log(value); //拿到选中的value
    },
    getUserSelect(value) {
      window.console.log(value); //
    }
  }
};
</script>
